﻿@using Lightning
@{
	dynamic requestData = Context.GetRequestData();
}
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>@requestData.Content.Title</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />

		<meta name="author" content="@Utilities.GetValue(requestData.Content, "Author", "")" />
		<meta name="description" content="@Utilities.GetValue(requestData.Content, "Description", "")" />
		<meta name="keywords" content="@Utilities.GetValue(requestData.Content, "Keywords", "")" />

		<meta name="generator" content="lightning" />
		<meta name="application-name" content="lightning" />

		<link href="@this.GetPath("assets/bootstrap/css/bootstrap.min.css")" rel="stylesheet" />
		<link href="@this.GetPath("assets/app/css/app.css")" rel="stylesheet" />

		<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
		<!--[if lt IE 9]>
		  <script src="@this.GetPath("assets/html5shiv/html5shiv.js")"></script>
		<![endif]-->

		<!-- fav and touch icons -->
		<link rel="shortcut icon" href="@this.GetPath("assets/app/ico/favicon.png")" />
		<link rel="apple-touch-icon-precomposed" sizes="144x144" href="@this.GetPath("assets/app/ico/apple-touch-icon-144-precomposed.png")" />
		<link rel="apple-touch-icon-precomposed" sizes="114x114" href="@this.GetPath("assets/app/ico/apple-touch-icon-114-precomposed.png")" />
		<link rel="apple-touch-icon-precomposed" sizes="72x72" href="@this.GetPath("assets/app/ico/apple-touch-icon-72-precomposed.png")" />
		<link rel="apple-touch-icon-precomposed" href="@this.GetPath("assets/app/ico/apple-touch-icon-57-precomposed.png")" />

		<link rel="author" href="humans.txt" />
	
		@RenderSection("head", false)
	
	</head>

	<body>
		<div id="wrap">
			<!-- Fixed navbar -->
			<div class="navbar navbar-default navbar-fixed-top">
				<div class="container">
					<div class="navbar-header">
						<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
							<span class="icon-bar"></span>
							<span class="icon-bar"></span>
							<span class="icon-bar"></span>
						</button>
						<a class="navbar-brand" href="@VirtualPathUtility.ToAbsolute("~/")">@Html.Raw(Context.GetConfigurationValue("siteTitle", ""))</a>
					</div>
					<div class="collapse navbar-collapse">
						<ul class="nav navbar-nav">
						@foreach (var content in ((IEnumerable<dynamic>)requestData.Contents).Where(c => c.Enabled == "true" && c.Menu != "" && c.Slug != "index").OrderBy(c => int.Parse(c.Position)))
	  {
							<li class="@((requestData.Content != null && content.Slug == requestData.Content.Slug) ? "active" : "")"><a href="@(Utilities.GetValue(content, "Url", "/" + content.Slug))">@content.Menu</a></li>						
	  }
						</ul>
					</div>
					<!--/.nav-collapse -->
				</div>
			</div>
		
			<div class="container">
				<div class="row">

					@RenderBody()

				</div>
			</div>	

		</div>
		@if (Utilities.GetContentBySlug(requestData.Contents, "_footer") == null)
		{
			<div id="footer">
				<div class="container">
					<p>Code licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>, documentation under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
					<ul class="footer-links">
						<li><a href="http://simpdev.net/lightning">Powered By Lightning (@Lightning.Module.Version)</a></li>
					</ul>
				</div>
			</div>
		}
		else
		{
			@Html.Raw(Utilities.GetContentBySlug(requestData.Contents, "_footer").GetContent())
		}

		<!-- use cdn with fallback to local -->

		<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
		<script>window.jQuery || document.write(unescape('%3Cscript src="@this.GetPath("assets/jquery/jquery.js")"%3E%3C/script%3E'))</script>
		
		<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
		<script>$.fn.modal || document.write('<script src="@this.GetPath("assets/bootstrap/js/bootstrap.js")">\x3C/script>')</script>

		<script>
			(function (i, s, o, g, r, a, m) {
				i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
					(i[r].q = i[r].q || []).push(arguments)
				}, i[r].l = 1 * new Date(); a = s.createElement(o),
				m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
			})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

			ga('create', '@Context.GetConfigurationValue("trackingCode", "")', '@Context.GetConfigurationValue("trackingDomain", "")');
			ga('send', 'pageview');

		</script>

	</body>
</html>
